package com.eims.sls_app.ui;

import com.eims.sls_app.utils.SharedPreferenceUtils;

import bls.juejin.cn.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;

public class SplashActivity extends MyBaseActivity {
	public static final String FIRST_OPEN = "first_open";
	private Handler handler;
	private Intent intent;
	private boolean isFirst;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		 //全屏
        getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN , WindowManager.LayoutParams. FLAG_FULLSCREEN);
        isFirst = SharedPreferenceUtils.getBoolean(this, FIRST_OPEN);
        if (!isFirst) {
        	intent = new Intent(SplashActivity.this, GuideActivity.class);
        	intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        	startActivity(intent);
            finish();
		}
        setContentView(R.layout.activity_splash);
		
		initData();
		initView();
	}

	private void initView() {
		
		
	}

	private void initData() {
		handler = new Handler();
		handler.postDelayed(new Runnable() {
			
			@Override
			public void run() {
				if (isFinishing()) {
					return;
				}
				/*//intent = new Intent(SplashActivity.this, MainActivity.class);
				if (isFirst) {
	                
	                SharedPreferenceUtils.setBooleanData("isFirst", false);

	            } else {
	                
	            }*/
				
				intent = new Intent(SplashActivity.this, MainActivity.class);
				intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				startActivity(intent);
		        finish();
			}
		}, 3000);
		
	}

}
